﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:data="clr-namespace:SnowmanConsulting.ProductKeyManager.Data;assembly=SnowmanConsulting.ProductKeyManager.Data"
    xmlns:ui="clr-namespace:SnowmanConsulting.ProductKeyManager.UI">

    <!-- DataTemplate Styles -->
    <Style x:Key="ProductItemContainer" TargetType="{x:Type StackPanel}">
        <Setter Property="Width" Value="100"/>
        <Setter Property="Orientation" Value="Vertical"/>
    </Style>
    <Style x:Key="ProductItemIcon" TargetType="{x:Type Image}">
        <Setter Property="Width" Value="32"/>
        <Setter Property="Height" Value="32"/>
        <Setter Property="HorizontalAlignment" Value="Center"/>
    </Style>
    <Style x:Key="ProductItemName" TargetType="{x:Type TextBlock}">
        <Setter Property="TextWrapping" Value="Wrap"/>
        <Setter Property="TextAlignment" Value="Center"/>
        <Setter Property="FontWeight" Value="SemiBold"/>
    </Style>
    <Style x:Key="ProductItemKeys" TargetType="{x:Type TextBlock}">
        <Setter Property="TextWrapping" Value="Wrap"/>
        <Setter Property="TextAlignment" Value="Center"/>
        <Setter Property="FontWeight" Value="Normal"/>
        <Style.Triggers>
            <DataTrigger Binding="{Binding Path=KeyCount}" Value="0">
                <Setter Property="Visibility" Value="Collapsed"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>
    <Style TargetType="{x:Type ListBoxItem}">
        <Setter Property="Padding" Value="3"/>
    </Style>
    
    <DataTemplate DataType="{x:Type data:Product}">
        <StackPanel Style="{StaticResource ProductItemContainer}" ToolTip="{Binding Path=Name}">
            <StackPanel Orientation="Vertical">
                <Image Style="{StaticResource ProductItemIcon}" Source="{Binding Path=Icon.Image}"/>
                <TextBlock Style="{StaticResource ProductItemName}" Text="{Binding Path=Name}"/>
                <TextBlock Style="{StaticResource ProductItemKeys}">
                            <TextBlock x:Uid="ProductsPage.ProductDataTemplate.Keys" Text="Keys: "/>
                            <TextBlock Text="{Binding Path=Keys.Count}"/>
                        </TextBlock>
            </StackPanel>
        </StackPanel>
    </DataTemplate>
</ResourceDictionary>